"""
过滤出长度大于3的人名
name = ['tom','lily','jacks','Pe','Steven']
2）得到嵌套列表中每个列表的最后一个元素
list1 = [[1,2,3],[4,5,6],[7,8,9]]
3）员工工资>5000的人加200，否则加500
dict1 = {'name':'张三','salary':6000}
dict2 = {'name':'李四','salary':8000}
dict3 = {'name':'王五','salary':4000}
dict4 = {'name':'吴二','salary':3000}
list2 = [dict1,dict2,dict3,dict4]
4）找到分数60分以下的人姓名
scores = {
      "Rick Sanchez": 70,
      "Morty Smith": 35,
      "Summer Smith": 82,
      "Jerry Smith": 23,
      "Beth Smith": 98
    }

"""
name = ['tom', 'lily', 'jacks', 'Pe', 'Steven']
dict1 = [a for a in name if len(a) > 3]
dict1 = [name[i] for i in range(len(name)) if len(name[i]) > 3]
print(dict1)
list1 = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
dict2 = [list1[i][j] for i in range(len(list1)) for j in range(len(list1)) if j == 2]
print(dict2)

dict1 = {'name': '张三', 'salary': 6000}
dict2 = {'name': '李四', 'salary': 8000}
dict3 = {'name': '王五', 'salary': 4000}
dict4 = {'name': '吴二', 'salary': 3000}
list2 = [dict1, dict2, dict3, dict4]
# e是字典 比如:{'name':'张三',‘salary’:6000}
# 取出工资e['salary] e.get('sqlary',0)
# 工资>5000的人加200,否则加500
# li3=[e['salary'] for e in list2]
a = [(e['name'], e['salary'] + 200) if e['salary'] > 5000 else (e['name'],e['salary'] + 500) for e in list2]
print(a)

scores = {
      "Rick Sanchez": 70,
      "Morty Smith": 35,
      "Summer Smith": 82,
      "Jerry Smith": 23,
      "Beth Smith": 98
    }
c={key:value for key,value in scores.items() if value<60}
print(c)